<?php

class SecurityInit extends Extension implements i18nEntityProvider {
	function onAfterInit(){
		if($this->owner->hasExtension('Translatable') && $this->owner->exists()) {
    		Session::set('locale', $controller->dataRecord->Locale);
        } else if(isset($_REQUEST['locale']) && $_REQUEST['locale']){
        	Session::set('locale', $_REQUEST['locale']);
        } else if(isset($_REQUEST['Locale']) && $_REQUEST['Locale']){
        	Session::set('locale', $_REQUEST['Locale']);
        }

		i18n::set_locale(Session::get('locale'));
		if(ClassInfo::exists('Translatable')){
			$this->owner->Locale = Session::get('locale');
		}
	}
	
	function provideI18nEntities() {
		$entities = array();
		$entities['Security.LOSTPASSWORDHEADER'] = array('Reset Login Password');
		$entities['Security.BUTTONSEND'] = array('Reset Password');
		return $entities;
	}
}